Repository navigation
fix(ui): keep the icon's room on a menu's rows without one - #83
Merged
Merged
Conversation
A menu that shows an icon on some rows painted the label of every other row 24px further left, so the labels of one menu started at two edges. When an item row of a menu has an icon, its rows without one, its submenu triggers, checkboxes and labels now take the inset the icon would, as macOS and IntelliJ menus do. A menu with no icon is unchanged. contextItem dropped Inset on the way to the context menu, and menuItemsRow was an unused copy of menuItemRow; both are fixed with it.
29 of 32 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
把上游 vivaui/viva#523 的同一个补丁(菜单里无图标的行保留图标位置)cherry-pick 到当前 fork
main(d71b14c6)上,不带入其他上游提交。只改ui/menu_paint.go,新增ui/menu_icon_inset_test.go。同一个菜单只要有一行带图标,其余无图标的行、子菜单入口、勾选行和分组标题都设置
Inset,文字从同一条竖线开始;整个菜单都没有图标时布局不变。contextItem补上漏传的Inset,并删掉没有调用方的menuItemsRow副本。Why
Lithe 正在给编辑器、项目树、标签页等右键菜单加 IntelliJ 图标,只有部分动作有原始图标,其余故意留空。没有这个补丁时,无图标行的文字比有图标行靠左 24px。Lithe 侧的改动会先临时固定本 PR 的 head,本 PR 合入后换成 fork
main的提交再标记 ready。How it was verified
gofmt -l对改动文件无输出。go vet ./ui/... ./components/... ./base/...无输出。go test ./ui/... ./components/... ./base/... -count=1全部通过,包括新测试TestMenuRowsWithoutAnIconKeepTheIconsRoom(dropdown 和 context 两种菜单)。go test ./...:除与本改动无关的cmd/viva既有失败(componentgen 模板过期、本机打包部署目标环境)外全部通过,详见 fix(ui): keep the icon's room on a menu's rows without one vivaui/viva#523。BenchmarkMenuOpen、BenchmarkPageTextFieldsEditMenu,各 8 次,macOS arm64,非空闲机器)差异在噪声内,仍是 0 B/op、0 allocs/op,数字见 fix(ui): keep the icon's room on a menu's rows without one vivaui/viva#523。Where the boundary sits
菜单行与图标列的对齐属于 Viva 的菜单组件;应用没有 API 设置
Inset,也不应该自己补偿缩进。